﻿//StarLine 星形线
//vesion 1.0
//author 夏天的树人
package org.summerTree.graphics
{

	public class StarLine extends Base 
	{
		//private var LineColor:uint=0x000000;//默认是黑色
		public function StarLine()
		{
			//this.graphics.lineStyle(1,color);
			
		}
		override public function clone():*
		{
			return new StarLine();
		}
				
		//创建图案
		public function CreatStarLine(radius:Number,fillColor:uint=0xffffff,alpha:Number=1):void
		{
			this.graphics.moveTo(0,0);
			this.graphics.lineStyle(1,color);
			this.graphics.beginFill(fillColor,alpha);
			for (var i:int=0; i<=360; i++)
			{
				var px:Number=radius*Math.pow(Math.cos(i*Math.PI/180),3);
				var py:Number=radius*Math.pow(Math.sin(i*Math.PI/180),3);
				if (i==0)
				{
					this.graphics.moveTo(px,py);
					drawPoint(px,py);
				}
				else
				{
					drawPoint(px,py);
				}
			}		
			this.graphics.endFill();
		}

		//绘制线
		public function drawStarLine(radius:Number,angle:Number):void
		{
			var px:Number=radius*Math.pow(Math.cos(angle*Math.PI/180),3);
			var py:Number=radius*Math.pow(Math.sin(angle*Math.PI/180),3);
			drawPoint(px,py);
		}
		//绘制线程序
		private function drawPoint(x1,y1:Number):void
		{
			this.graphics.lineTo(x1,y1);
		}
		////设置颜色
//		public function set color(value:uint):void
//		{
//			this.LineColor=value;
//		}
//		//获取颜色
//		public function get color():uint
//		{
//			return this.LineColor;
//		}
		//清除图像
		//public function clear():void
//		{
//			this.graphics.clear();
//		}
	}
}